<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="get" action="">
            <i>Filtrar</i>
            
            <input type="text" id="dtfiltro" name="dtfiltro" class="data" placeholder="Data" value="<?php echo $this->dtfiltro?>" />
            
            &nbsp;
            
            <input type="text" id="dtfilfim" name="dtfilfim" class="data" placeholder="Data Final" value="<?php echo $this->dtfilfim?>" />
            
            &nbsp;
            
            <input type="text" name="filtro_nm" placeholder="Aluno" value="<?php echo $this->filtro_nm?>" />
            
            <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
            
        </form>
    </div>
    <?php if($this->per_add){?>
    <div class="content-btn">
        <span>Nova</span><a href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit','id'=>'')); ?>">+</a>
    </div>
    <?php } ?>
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    <br>
    
    <ul class="list-alunos">
    <?php foreach ($this->result as $row) { 

        $img = ''; 
        $imgs = 'public/upload/aluno/'.$row['ALU_ID'].'_tmb.*';
        foreach (glob($imgs) as $src) {
            $img = $src;
        }
        if(strlen($img) < 5){
            $img = 'public/media/images/aluno.png'; 
        }
        
        $query = ' SELECT SQL_CACHE distinct(a.ALU_ID), m.MAT_ID, m.MAT_DATHOR, c.CUR_ID '
                .' FROM ALUNO a '
                .' INNER JOIN MATRICULA m ON m.ALU_ID = a.ALU_ID AND MAT_STA = 1 '
                .' INNER JOIN CURSO c ON c.CUR_ID = m.CUR_ID AND CUR_STA = 1 AND CUR_ANO = "'.date('Y-m-d').'"'
                .' WHERE a.ALU_ID = '.$row['ALU_ID'];
        $result = $this->db->fetchRow($query);
        $alu = $result;
        
    ?> 
        <li>
            <div class="content-foto"><img src="<?php echo '/'.$img; ?>" /></div>
            <div class="row"><strong><?php echo $row['ALU_NOM'].' - '.$row['ALU_ID']; ?></strong></div>
            <div class="row">Agendado às <?php echo Datetools::invert($row['AGA_DAT']).' '.Datetools::hora_hm($row['AGA_HORINI']).' às '.Datetools::hora_hm($row['AGA_HORFIM']); ?></div>
            <?php /* ?><div class="row"><?php echo Datetools::invertDH_D($alu['MAT_DATHOR']); ?> - <?php echo $alu['MAT_ID'];?></div> <?php */ ?>
            <div class="row rwu"><?php echo dominio::getTurma($alu['CUR_ID'],0); ?></div>
            <div class="content-btn">
                <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['AGA_ID'])); ?>">Editar</a><?php }?>
                <?php if($this->per_del && ($row['AGA_STA'] == 0)){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['AGA_ID'] ?>, $(this));">Deletar</a><?php }  ?>
                <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => 'atendimentonap', 'action' => 'aluno', 'alu_id' => $row['ALU_ID'])); ?>">Atendimento</a><?php }?>
            </div>
        </li>
    <?php  } ?>
    </ul>
    
    <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
</div>
<script>dataPicker($('.data'));</script>